| Conditions | 2 |
| Total Lines | 24 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { QueryHandler } from '@nestjs/cqrs'; |
||
| 14 | |||
| 15 | public async execute( |
||
| 16 | query: GetSchoolsQuery |
||
| 17 | ): Promise<Pagination<SchoolView>> { |
||
| 18 | const { page } = query; |
||
| 19 | const schoolViews: SchoolView[] = []; |
||
| 20 | const [ schools, total ] = await this.schoolRepository.findSchools(page); |
||
| 21 | |||
| 22 | for (const school of schools) { |
||
| 23 | schoolViews.push( |
||
| 24 | new SchoolView( |
||
| 25 | school.getId(), |
||
| 26 | school.getName(), |
||
| 27 | school.getReference(), |
||
| 28 | school.getAddress(), |
||
| 29 | school.getCity(), |
||
| 30 | school.getZipCode(), |
||
| 31 | school.getStatus(), |
||
| 32 | school.getType() |
||
| 33 | ) |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | |||
| 37 | return new Pagination<SchoolView>(schoolViews, total); |
||
| 38 | } |
||
| 40 |